package org.hank.demoproject

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import org.hank.demoproject.adapter.DemoInfo
import org.hank.demoproject.adapter.MainAdapter
import org.hank.demoproject.animation.shakeview.ShakeActivity
import org.hank.demoproject.coil.CoilActivity
import org.hank.demoproject.databinding.DataBindingActivity
import org.hank.demoproject.fragment_result.FragmentResultActivity
import org.hank.demoproject.httphelper.HttpActivity
import org.hank.demoproject.iso8583_1987.ISO8583TestActivity
import org.hank.demoproject.room.RoomActivity
import org.hank.demoproject.smartrefresh.SmartRefreshActivity
import org.hank.demoproject.smarttable.SmartTableActivity
import org.hank.demoproject.socket.SocketActivity
import org.hank.demoproject.test.TestActivity

class MainActivity() : AppCompatActivity() {
    var mainAdapter = MainAdapter(initList())
    var testStr: String? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
       findViewById<RecyclerView>(R.id.recycler_main) .apply {
           layoutManager = LinearLayoutManager(this@MainActivity)
            adapter = mainAdapter
        }

    }

    fun initList(): MutableList<DemoInfo> {
        var list: MutableList<DemoInfo> = ArrayList()
        list.add(DemoInfo("Room", RoomActivity::class.java))
        list.add(DemoInfo("ISO8583", ISO8583TestActivity::class.java))
        list.add(DemoInfo("SocketDEMO", SocketActivity::class.java))
        list.add(DemoInfo("TestActivity", TestActivity::class.java))
        list.add(DemoInfo("CoilTest", CoilActivity::class.java))
        list.add(DemoInfo("ShakeView", ShakeActivity::class.java))
        list.add(DemoInfo("FragmentResult", FragmentResultActivity::class.java))
        list.add(DemoInfo("Databindin", DataBindingActivity::class.java))
        list.add(DemoInfo("SmartRefresh", SmartRefreshActivity::class.java))
        list.add(DemoInfo("SmartTable", SmartTableActivity::class.java))
        list.add(DemoInfo("HttpTest", HttpActivity::class.java))
        return list
    }

}